{extend name="common/base"/}
{block name="style"}
<style>
	.layui-tab-content{
		padding: unset;
	}
	.layui-td-gray{
		width: 90px;
	}
</style>
{/block}

<!-- 主体 -->
{block name="body"}
<h3 style="padding: 10px;">事项管理</h3>
<form class="layui-form">
<div class="layui-tab layui-tab-card" lay-filter="matter_menu">
	<ul class="layui-tab-title">
		<li class="layui-this">基本信息</li>
<!--		<li>审查要点</li>-->
		<li>常见问题</li>
		<li>相关文件</li>
	</ul>
	<div class="layui-tab-content">
		<div class="layui-tab-item layui-show">
			<table class="layui-table">
				<tr>
					<td class="layui-td-gray">事项名称<font>*</font></td>
					<td>
						<input type="text" name="name" value="{notempty name="$detail.name"}{$detail.name}{/notempty}" lay-verify="required" autocomplete="off" placeholder="请输入事项名称" lay-reqText="请输入事项名称" class="layui-input">
					</td>
					<td class="layui-td-gray">事项名称<br>（口头语）</td>
					<td>
						<input type="text" name="oral_name" value="{notempty name="$detail.oral_name"}{$detail.oral_name}{/notempty}" autocomplete="off" placeholder="请输入事项名称" lay-reqText="请输入事项名称" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">地区<font>*</font></td>
					<td>
						<select name="area_id" id="area_id" lay-filter="area_id" lay-search lay-verify="required" lay-reqText="请选择地区">
							<option value="">请选择</option>
							{volist name="$area_list" id="v"}
							<option value="{$v.id}" {notempty name="$detail.area_id"}{eq name="$detail.area_id" value="$v.id"} selected{/eq}{/notempty}>{$v.name}</option>
							{/volist}
						</select>
					</td>
					<td class="layui-td-gray">上级目录<font>*</font></td>
					<td>
						<select name="directory_id" id="directory_id" lay-search lay-reqText="请选择上级目录">
							<option value="">请选择</option>
							{notempty name="$detail.area_id"}
							{volist name="$directory_list" id="v"}
							<option value="{$v.id}" {notempty name="$detail.directory_id"}{eq name="$detail.directory_id" value="$v.id"} selected{/eq}{/notempty}>{$v.name}</option>
							{/volist}
							{/notempty}
						</select>
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">服务类型</td>
					<td>
						{foreach :config('matter.service_type') as $k=>$v }
						<input type="radio" name="service_type" lay-filter="service_type" title="{$v}" value="{$k}"  {notempty name="$detail.service_type"}{eq name="$detail.service_type" value="$k" }checked{/eq}{/notempty} lay-skin="primary">
						{/foreach}
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">主题</td>
					<td colspan="5" id="theme_id">
						{notempty name="$detail.service_type"}
						{volist name=":get_theme_list($detail.service_type)" id="v"}
						<input type="checkbox" name="theme_id[]" title="{$v.name}" value="{$v.id}"  {notempty name="$detail"}{volist name="$detail.theme_id" id="vo"}{eq name="$v.id" value="$vo" }checked{/eq}{/volist}{/notempty} lay-skin="primary">
						{/volist}
						{/notempty}
					</td>
				</tr>
				<tr>
					<td colspan="4"><strong>基本信息</strong></td>
				</tr>
				<tr>
					<td class="layui-td-gray">基本编码</td>
					<td>
						<input type="text" name="base_code" value="{notempty name="$detail.base_code"}{$detail.base_code}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
					<td class="layui-td-gray">实施编码</td>
					<td>
						<input type="text" name="implement_code" value="{notempty name="$detail.implement_code"}{$detail.implement_code}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">实施主体<font>*</font></td>
					<td>
						<select name="unit_id" id="unit_id" lay-search lay-reqText="请选择部门">
							<option value="">请选择</option>
							{notempty name="$detail.unit_id"}
							{volist name="$unit_list" id="v"}
							<option value="{$v.id}" {notempty name="$detail.unit_id"}{eq name="$detail.unit_id" value="$v.id"} selected{/eq}{/notempty}>{$v.name}</option>
							{/volist}
							{/notempty}
						</select>
					</td>
					<td class="layui-td-gray">实施主体编码</td>
					<td>
						<input type="text" name="implement_subject_code" value="{notempty name="$detail.implement_subject_code"}{$detail.implement_subject_code}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">实施主体性质</td>
					<td>
						{foreach :config('matter.implement_subject_nature') as $k=>$v }
						<input type="radio" name="implement_subject_nature" title="{$v}" value="{$k}"  {notempty name="$detail.implement_subject_nature"}{eq name="$detail.implement_subject_nature" value="$k" }checked{/eq}{else/}{eq name="$k" value="1"}checked{/eq}{/notempty} lay-skin="primary">
						{/foreach}
					</td>
					<td class="layui-td-gray">行使层级</td>
					<td colspan="4">
						{foreach :config('matter.exercise_level') as $k=>$v }
						<input type="radio" name="exercise_level" lay-filter="exercise_level" title="{$v}" value="{$k}"  {notempty name="$detail.exercise_level"}{eq name="$detail.exercise_level" value="$k" }checked{/eq}{else/}{eq name="$k" value="1"}checked{/eq}{/notempty} lay-skin="primary">
						{/foreach}
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">权力来源</td>
					<td>
						<input type="text" name="power_source" value="{notempty name="$detail.power_source"}{$detail.power_source}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
					<td class="layui-td-gray">联办机构</td>
					<td>
						<input type="text" name="joint_agency" value="{notempty name="$detail.joint_agency"}{$detail.joint_agency}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">事项类型</td>
					<td colspan="4">
						{foreach :config('matter.event_type') as $k=>$v }
						<input type="radio" name="event_type" title="{$v}" value="{$k}"  {notempty name="$detail.event_type"}{eq name="$detail.event_type" value="$k" }checked{/eq}{else/}{eq name="$k" value="1"}checked{/eq}{/notempty} lay-skin="primary">
						{/foreach}
					</td>

				</tr>
				<tr>
					<td class="layui-td-gray">数量限制</td>
					<td>
						<input type="text" name="limitation" value="{notempty name="$detail.limitation"}{$detail.limitation}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">事项状态</td>
					<td>
						{foreach :config('matter.event_status') as $k=>$v }
						<input type="radio" name="event_status" title="{$v}" value="{$k}"  {notempty name="$detail.event_status"}{eq name="$detail.event_status" value="$k" }checked{/eq}{else/}{eq name="$k" value="1"}checked{/eq}{/notempty} lay-skin="primary">
						{/foreach}
					</td>
					<td class="layui-td-gray">事项版本</td>
					<td>
						<input type="text" name="event_version" value="{notempty name="$detail.event_version"}{$detail.event_version}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td colspan="4"><strong>办事信息</strong></td>
				</tr>
				<tr>
					<td class="layui-td-gray">服务对象</td>
					<td colspan="4">
						{foreach :config('matter.service_object') as $k=>$v }
						<input type="checkbox" name="service_object[]" title="{$v}" value="{$k}"  {notempty name="$detail"}{volist name="$detail.service_object" id="vo"}{eq name="$k" value="$vo" }checked{/eq}{/volist}{/notempty} lay-skin="primary">
						{/foreach}
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">办件类型</td>
					<td>
						{foreach :config('matter.processing_type') as $k=>$v }
						<input type="radio" name="processing_type" title="{$v}" value="{$k}"  {notempty name="$detail.processing_type"}{eq name="$detail.processing_type" value="$k" }checked{/eq}{else/}{eq name="$k" value="1"}checked{/eq}{/notempty} lay-skin="primary">
						{/foreach}
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">通办范围</td>
					<td>
						<input type="text" name="scope_application" value="{notempty name="$detail.scope_application"}{$detail.scope_application}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
					<td class="layui-td-gray">中介服务</td>
					<td>
						<input type="text" name="intermediary_services" value="{notempty name="$detail.intermediary_services"}{$detail.intermediary_services}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">办理形式</td>
					<td>
						{foreach :config('matter.application_form') as $k=>$v }
						<input type="checkbox" name="application_form[]" title="{$v}" value="{$k}"  {notempty name="$detail"}{volist name="$detail.application_form" id="vo"}{eq name="$k" value="$vo" }checked{/eq}{/volist}{/notempty} lay-skin="primary">
						{/foreach}
					</td>
					<td class="layui-td-gray">是否进驻政务大厅</td>
					<td>
						<input type="radio" name="is_entry" value="1" title="是" {notempty name="$detail.is_entry"}{eq name="$detail.is_entry" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="is_entry" value="0" title="否" {notempty name="$detail.is_entry"}{eq name="$detail.is_entry" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">是否网办</td>
					<td>
						<input type="radio" name="is_online_office" value="1" title="是" {notempty name="$detail.is_online_office"}{eq name="$detail.is_online_office" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="is_online_office" value="0" title="否" {notempty name="$detail.is_online_office"}{eq name="$detail.is_online_office" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
					<td class="layui-td-gray">网上办理深度</td>
					<td>
						<input type="text" name="online_office_depth" value="{notempty name="$detail.online_office_depth"}{$detail.online_office_depth}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">计算机端是否对接单点登录</td>
					<td>
						<input type="radio" name="computer_is_login" value="1" title="是" {notempty name="$detail.computer_is_login"}{eq name="$detail.computer_is_login" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="computer_is_login" value="0" title="否" {notempty name="$detail.computer_is_login"}{eq name="$detail.computer_is_login" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
					<td class="layui-td-gray">计算机端在线办理跳转地址</td>
					<td>
						<input type="text" name="computer_link" value="{notempty name="$detail.computer_link"}{$detail.computer_link}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">移动端是否对接单点登录</td>
					<td>
						<input type="radio" name="phone_is_login" value="1" title="是" {notempty name="$detail.phone_is_login"}{eq name="$detail.phone_is_login" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="phone_is_login" value="0" title="否" {notempty name="$detail.phone_is_login"}{eq name="$detail.phone_is_login" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
					<td class="layui-td-gray">移动端办理地址</td>
					<td>
						<input type="text" name="phone_link" value="{notempty name="$detail.phone_link"}{$detail.phone_link}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">是否支持自助终端办理</td>
					<td>
						<input type="radio" name="is_self_service" value="1" title="是" {notempty name="$detail.is_self_service"}{eq name="$detail.is_self_service" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="is_self_service" value="0" title="否" {notempty name="$detail.is_self_service"}{eq name="$detail.is_self_service" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
					<td class="layui-td-gray">是否支持预约办理</td>
					<td>
						<input type="radio" name="is_reservation" value="1" title="是" {notempty name="$detail.is_reservation"}{eq name="$detail.is_reservation" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="is_reservation" value="0" title="否" {notempty name="$detail.is_reservation"}{eq name="$detail.is_reservation" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">是否收费</td>
					<td>
						<input type="radio" name="is_charge" value="1" title="是" {notempty name="$detail.is_charge"}{eq name="$detail.is_charge" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="is_charge" value="0" title="否" {notempty name="$detail.is_charge"}{eq name="$detail.is_charge" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
					<td class="layui-td-gray">是否支持网上支付</td>
					<td>
						<input type="radio" name="is_online_payment" value="1" title="是" {notempty name="$detail.is_online_payment"}{eq name="$detail.is_online_payment" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="is_online_payment" value="0" title="否" {notempty name="$detail.is_online_payment"}{eq name="$detail.is_online_payment" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">是否支持物流快递</td>
					<td>
						<input type="radio" name="is_express_delivery" value="1" title="是" {notempty name="$detail.is_express_delivery"}{eq name="$detail.is_express_delivery" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="is_express_delivery" value="0" title="否" {notempty name="$detail.is_express_delivery"}{eq name="$detail.is_express_delivery" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
				</tr>
				<tr>
					<td colspan="4"><strong>审批结果</strong></td>
				</tr>
				<tr>
					<td class="layui-td-gray">审批结果类型</td>
					<td>
						<input type="text" name="approval_result_type" value="{notempty name="$detail.approval_result_type"}{$detail.approval_result_type}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
					<td class="layui-td-gray">审批结果名称</td>
					<td>
						<input type="text" name="approval_result_name" value="{notempty name="$detail.approval_result_name"}{$detail.approval_result_name}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">审批结果样本</td>
					<td colspan="5" style="line-height:inherit">
						<button type="button" class="layui-btn layui-btn-sm" id="uploadBtn"><i class="layui-icon"></i>上传</button>
						<div class="layui-row" id="fileBox">
							<input type="hidden" id="fileBoxInput" name="approval_result_sample" value="{notempty name='$detail.approval_result_sample'}{$detail.approval_result_sample}{/notempty}">
							{notempty name="$detail.approval_result_sample"}
							{volist name="$detail.approval_result_sampleArray" id="vo"}
							<div class="layui-col-md4" id="fileItem{$vo.id}">
								<div class="file-card">
									<i class="file-icon iconfont icon-renwuguanli"></i>
									<div class="file-title">{$vo.name}</div>
									<div class="file-tool">
										<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看" style="font-size: 14px;">下载</a>
										<i class="btn-delete iconfont icon-shanchu red" data-id="{$vo.id}" title="删除" style="font-size: 14px;">删除</i>
									</div>
								</div>
							</div>
							{/volist}
							{/notempty}
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="4"><strong>其它</strong></td>
				</tr>
				<tr>
					<td class="layui-td-gray">法定时限</td>
					<td>
						<input type="text" name="legal_time" value="{notempty name="$detail.legal_time"}{$detail.legal_time}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
					<td class="layui-td-gray">法定办结时限单位</td>
					<td>
						<input type="text" name="legal_time_unit" value="{notempty name="$detail.legal_time_unit"}{$detail.legal_time_unit}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">承诺时限</td>
					<td>
						<input type="text" name="promise_time" value="{notempty name="$detail.promise_time"}{$detail.promise_time}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
					<td class="layui-td-gray">承诺办结时限单位</td>
					<td>
						<input type="text" name="promise_time_unit" value="{notempty name="$detail.promise_time_unit"}{$detail.promise_time_unit}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">定期检验及依据</td>
					<td colspan="5" style="line-height:inherit">
						<textarea name="according_to" placeholder="请输入" class="layui-textarea">{notempty name="$detail.according_to"}{$detail.according_to}{/notempty}</textarea>
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">运行系统</td>
					<td colspan="5" style="line-height:inherit">
						<input type="text" name="system" value="{notempty name="$detail.system"}{$detail.system}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">禁止性要求</td>
					<td colspan="5" style="line-height:inherit">
						<textarea name="prohibit" placeholder="请输入" class="layui-textarea">{notempty name="$detail.prohibit"}{$detail.prohibit}{/notempty}</textarea>
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">受理机构</td>
					<td>
						<input type="text" name="acceptance_institution" value="{notempty name="$detail.acceptance_institution"}{$detail.acceptance_institution}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
					<td class="layui-td-gray">受理机构性质</td>
					<td>
						<input type="text" name="acceptance_institution_nature" value="{notempty name="$detail.acceptance_institution_nature"}{$detail.acceptance_institution_nature}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">决定机构</td>
					<td>
						<input type="text" name="decision_institution" value="{notempty name="$detail.decision_institution"}{$detail.decision_institution}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
					<td class="layui-td-gray">决定机构性质</td>
					<td>
						<input type="text" name="decision_institution_nature" value="{notempty name="$detail.decision_institution_nature"}{$detail.decision_institution_nature}{/notempty}" autocomplete="off" placeholder="请输入" lay-reqText="请输入" class="layui-input">
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">办理公示</td>
					<td>
						<textarea name="publicity" placeholder="请输入" class="layui-textarea">{notempty name="$detail.publicity"}{$detail.publicity}{/notempty}</textarea>
					</td>
					<td class="layui-td-gray">办理查询</td>
					<td>
						<textarea name="query" placeholder="请输入" class="layui-textarea">{notempty name="$detail.query"}{$detail.query}{/notempty}</textarea>
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">适用范围</td>
					<td>
						<textarea name="suit_scope" placeholder="请输入" class="layui-textarea">{notempty name="$detail.suit_scope"}{$detail.suit_scope}{/notempty}</textarea>
					</td>
					<td class="layui-td-gray">审批内容</td>
					<td>
						<textarea name="approval_content" placeholder="请输入" class="layui-textarea">{notempty name="$detail.approval_content"}{$detail.approval_content}{/notempty}</textarea>
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">权限划分</td>
					<td colspan="5" style="line-height:inherit">
						<textarea name="authority_division" placeholder="请输入" class="layui-textarea">{notempty name="$detail.authority_division"}{$detail.authority_division}{/notempty}</textarea>
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">是否容缺受理</td>
					<td>
						<input type="radio" name="is_acceptance_deficiency" value="1" title="是" {notempty name="$detail.is_acceptance_deficiency"}{eq name="$detail.is_acceptance_deficiency" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="is_acceptance_deficiency" value="0" title="否" {notempty name="$detail.is_acceptance_deficiency"}{eq name="$detail.is_acceptance_deficiency" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
					<td class="layui-td-gray">是否证明事项</td>
					<td>
						<input type="radio" name="is_proof_items" value="1" title="是" {notempty name="$detail.is_proof_items"}{eq name="$detail.is_proof_items" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="is_proof_items" value="0" title="否" {notempty name="$detail.is_proof_items"}{eq name="$detail.is_proof_items" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
				</tr>
				<tr>
					<td class="layui-td-gray">是否实行告知承诺</td>
					<td>
						<input type="radio" name="is_inform" value="1" title="是" {notempty name="$detail.is_inform"}{eq name="$detail.is_inform" value="1"}checked{/eq}{/notempty}>
						<input type="radio" name="is_inform" value="0" title="否" {notempty name="$detail.is_inform"}{eq name="$detail.is_inform" value="0"}checked{/eq}{else/}checked{/notempty}>
					</td>
				</tr>
			</table>
		</div>
<!--		<div class="layui-tab-item">-->
<!--			<div id="points">-->
<!--				{notempty name="$detail.points"}-->
<!--				{volist name="$detail.points" id="val"}-->
<!--				<table class="layui-table layui-table-min more_interfix">-->
<!--					<tr>-->
<!--						<input type="hidden" name="points_key" value="{$key+1}">-->
<!--						<td class="layui-td-gray"><font>*</font>审查要点{$key+1}</td>-->
<!--						<td colspan="5">-->
<!--							<textarea name="points[content][]" placeholder="请输入审查要点" class="layui-textarea">{$val.content}</textarea>-->
<!--							<input type="hidden" name="points[id][]" class="layui-input" value="{$val.id}">-->
<!--						</td>-->
<!--						<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="{$val.id}" lay-event="del">删除</a></td>-->
<!--					<tr>-->
<!--				</table>-->
<!--				{/volist}-->
<!--				{else/}-->
<!--				<table class="layui-table layui-table-min more_interfix">-->
<!--					<tr>-->
<!--						<input type="hidden" name="points_key" value="1">-->
<!--						<td class="layui-td-gray"><font>*</font>审查要点1</td>-->
<!--						<td colspan="5">-->
<!--							<textarea name="points[content][]" placeholder="请输入审查要点" class="layui-textarea"></textarea>-->
<!--							<input type="hidden" name="points[id][]" class="layui-input" value="0">-->
<!--						</td>-->
<!--						<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="0" lay-event="del">删除</a></td>-->
<!--					<tr>-->
<!--				</table>-->
<!--				{/notempty}-->
<!--			</div>-->
<!--			<div class="pt-2">-->
<!--				<button class="layui-btn layui-btn-sm" type="button" id="add_points">+ 添加</button>-->
<!--			</div>-->
<!--		</div>-->
		<div class="layui-tab-item">
			<div id="question">
				{notempty name="$detail.question"}
				{volist name="$detail.question" id="val"}
				<table class="layui-table layui-table-min more_interfix">
					<tr>
						<input type="hidden" name="question_key" value="{$key+1}">
						<td class="layui-td-gray"><font>*</font>常见问题{$key+1}</td>
						<td colspan="5">
							<textarea name="question[questions][]" placeholder="请输入常见问题" class="layui-textarea">{$val.questions}</textarea>
							<input type="hidden" name="question[id][]" class="layui-input" value="{$val.id}">
						</td>
						<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="{$val.id}" lay-event="del">删除</a></td>
					<tr>
					<tr>
						<td class="layui-td-gray"><font>*</font>解决方案</td>
						<td colspan="6">
							<textarea name="question[answers][]" placeholder="请输入解决方案" class="layui-textarea">{$val.answers}</textarea>
						</td>
					</tr>
				</table>
				{/volist}
				{else/}
				<table class="layui-table layui-table-min more_interfix">
					<tr>
						<input type="hidden" name="question_key" value="1">
						<td class="layui-td-gray"><font>*</font>常见问题1</td>
						<td colspan="5">
							<textarea name="question[questions][]" placeholder="请输入常见问题" class="layui-textarea"></textarea>
							<input type="hidden" name="question[id][]" class="layui-input" value="0">
						</td>
						<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="0" lay-event="del">删除</a></td>
					<tr>
					<tr>
						<td class="layui-td-gray"><font>*</font>解决方案</td>
						<td colspan="6">
							<textarea name="question[answers][]" placeholder="请输入解决方案" class="layui-textarea"></textarea>
						</td>
					</tr>
				</table>
				{/notempty}
			</div>
			<div class="pt-2">
				<button class="layui-btn layui-btn-sm" type="button" id="add_question">+ 添加</button>
			</div>
		</div>
		<div class="layui-tab-item">
			<table class="layui-table layui-table-min">
				<tr>
					<td class="layui-td-gray"><button type="button" class="layui-btn layui-btn-sm" id="uploadBtn1"><i class="layui-icon"></i>上传相关文件</button></td>
					<td colspan="5" style="line-height:inherit">
						<div class="layui-row" id="fileBox1">
							<input type="hidden" id="fileBox1Input" name="file_ids" value="{notempty name='$detail.file_ids'}{$detail.file_ids}{/notempty}">
							{notempty name="$detail.file_ids"}
							{volist name="$detail.file_idsArray" id="vo"}
							<div class="layui-col-md4" id="fileItem{$vo.id}">
								<div class="file-card">
									<i class="file-icon iconfont icon-renwuguanli"></i>
									<div class="file-title">{$vo.name}</div>
									<div class="file-tool">
										<a href="{$vo.filepath}" download="{$vo.name}" target="_blank" title="下载查看" style="font-size: 14px;">下载</a>
										<i class="btn-delete iconfont icon-shanchu red" data-id="{$vo.id}" title="删除" style="font-size: 14px;">删除</i>
									</div>
								</div>
							</div>
							{/volist}
							{/notempty}
						</div>
					</td>
				</tr>
			</table>
		</div>
	</div>
</div>

	<div class="py-3">
		<input type="hidden" name="id" value="{$id}">
		<button class="layui-btn layui-btn-normal" id="submit1" lay-submit="" lay-filter="webform">立即提交</button>
	</div>
</form>

{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
	const moduleInit = ['tool', 'treeGrid','oaTool'];
	function gouguInit() {
		var form = layui.form,tool=layui.tool,treeGrid = layui.treeGrid,oaTool = layui.oaTool,element = layui.element;

		oaTool.addFile({exts:'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf'});
		oaTool.addFile({btn:'uploadBtn1',exts:'png|jpg|gif|jpeg|doc|docx|ppt|pptx|xls|xlsx|pdf',box: `fileBox1`});

		// oaTool.addFile({exts:'doc|docx|ppt|pptx|xls|xlsx|png|jpg|jpeg|pdf'});


		//监听提交
		form.on('submit(webform)', function(data){
			let callback = function (e) {
				layer.msg(e.msg);
				if (e.code == 0) {
					setTimeout(function () {
						parent.location.reload();
					}, 1000);

				}
			}
			tool.post("/matter/matter/add", data.field, callback);
			return false;
		});

		//审查要点
		$('#add_points').on('click',function(){
			let sort = Number($('[name="points_key"]').last().val());
			sort = sort?sort+1:1;
			var html = '';
			html += `<table class="layui-table layui-table-min more_interfix">
						<tr>
							<input type="hidden" name="points_key" value="${sort}">
                            <td class="layui-td-gray"><font>*</font>审查要点${sort}</td>
                            <td colspan="5">
								<textarea name="points[content][]" placeholder="请输入审查要点" class="layui-textarea"></textarea>
								<input type="hidden" name="points[id][]" class="layui-input" value="0">
							</td>
							<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="0" lay-event="del">删除</a></td>
                        <tr>
                      </table>`;
			$("#points").append(html).find('.tr-none').remove();
			sort++;
			form.render();
		});
		$('#points').on('click', '[lay-event="del"]', function() {
			var that=$(this);
			var _id = that.data('id');
			if(_id>0){
				layer.confirm('确定删除该数据项？', {
					icon: 3,
					title: '提示'
				}, function(index) {
					$.ajax({
						url: "/matter/matter/points_delete",
						type:'post',
						data: {id: _id},
						success: function(res) {
							layer.msg(res.msg);
							if (res.code == 0) {
								that.parents(".more_interfix").remove();
							}
						}
					})
					layer.close(index);
				});
			}
			else{
				that.parents(".more_interfix").remove();
			}
		});

		//常见问题
		$('#add_question').on('click',function(){
			let sort = Number($('[name="question_key"]').last().val());
			sort = sort?sort+1:1;
			var html = '';
			html += `<table class="layui-table layui-table-min more_interfix">
						<tr>
							<input type="hidden" name="question_key" value="${sort}">
                            <td class="layui-td-gray"><font>*</font>常见问题${sort}</td>
                            <td colspan="5">
								<textarea name="question[questions][]" placeholder="请输入常见问题" class="layui-textarea"></textarea>
								<input type="hidden" name="question[id][]" class="layui-input" value="0">
							</td>
							<td><a class="layui-btn layui-btn-danger layui-btn-xs" data-id="0" lay-event="del">删除</a></td>
                        <tr>
                        <tr>
							<td class="layui-td-gray"><font>*</font>解决方案</td>
							<td colspan="6">
								<textarea name="question[answers][]" placeholder="请输入解决方案" class="layui-textarea"></textarea>
							</td>
						</tr>
                      </table>`;
			$("#question").append(html).find('.tr-none').remove();
			sort++;
			form.render();
		});
		$('#question').on('click', '[lay-event="del"]', function() {
			var that=$(this);
			var _id = that.data('id');
			if(_id>0){
				layer.confirm('确定删除该数据项？', {
					icon: 3,
					title: '提示'
				}, function(index) {
					$.ajax({
						url: "/matter/matter/question_delete",
						type:'post',
						data: {id: _id},
						success: function(res) {
							layer.msg(res.msg);
							if (res.code == 0) {
								that.parents(".more_interfix").remove();
							}
						}
					})
					layer.close(index);
				});
			}
			else{
				that.parents(".more_interfix").remove();
			}
		});

		//主题选择
		form.on('radio(service_type)', function(data){
			$.ajax({
				type:"get",
				url:"/matter/matter/getTheme?id="+data.value,
				dataType:"json",
				success:function (d) {
					//对应的值传回，拼出html下拉框语句
					var tmp='';
					for (var i in d){
						if(d[i].id>0){
							tmp +=`<input type="checkbox" name="theme_id[]" title="${d[i].name}" value="${d[i].id}" lay-skin="primary">`;
						}
					}
					$("#theme_id").html(tmp);
					form.render();
				},error:function () {
					layer.alert('请求失败');
				}
			});
		});

		//行使层级
		form.on('radio(exercise_level)', function(data){
			getUnit();
		});

		//省
		form.on('select(province)',function (data) {
			area_below($("#city"),data.value);
			$("#county").html('');
			$("#streets").html('');
			$("#village").html('');
		})
		//市
		form.on('select(city)',function (data) {
			area_below($("#county"),data.value);
			$("#streets").html('');
			$("#village").html('');
		})
		//县
		form.on('select(county)',function (data) {
			area_below($("#streets"),data.value);
			$("#village").html('');
		})
		//街道
		form.on('select(streets)',function (data) {
			area_below($("#village"),data.value);
		})
		//村居
		form.on('select(village)',function (data) {
			area_below('',data.value);
		})

		//获取下级地区
		function area_below(obj,pid=0){
			getUnit(pid)
			$.ajax({
				type:"get",
				url:"/matter/matter/getAreaBelow?id="+pid,
				dataType:"json",
				success:function (d) {
					if(d.length>0) {
						//对应的值传回，拼出html下拉框语句
						var tmp = '<option value="">请选择</option>';
						for (var i in d) {
							tmp += '<option value="' + d[i].id + '">' + d[i].name + '</option>';
						}
						obj.html(tmp);
						form.render();
					}
				},error:function () {
					layer.alert('请求失败');
				}
			});
		}


		//地区选择
		let area_id = $('#area_id').val();
		let directory_id = $('#directory_id').val();
		let unit_id = $('#unit_id').val();
		if(area_id && !directory_id){
			getDirectory(area_id);
		}
		if(area_id && !unit_id){
			getUnit(area_id);
		}
		form.on('select(area_id)',function (data) {
			let area_id = data.value;
			getUnit(area_id);
			getDirectory(area_id);
		})
		//获取部门
		function getUnit(id){
			$.ajax({
				type:"get",
				url:"/matter/matter/getUnit?id="+id,
				dataType:"json",
				success:function (d) {
					if(d.length>0){
						//对应的值传回，拼出html下拉框语句
						var tmp='<option value="">请选择，输入关键字检索</option>';
						for (var i in d){
							tmp +='<option value="'+d[i].id+'">'+d[i].name+'</option>';
						}
						$("#unit_id").html(tmp);
						form.render();
					}

				},error:function () {
					layer.alert('请求失败');
				}
			});
		}
		//获取目录
		function getDirectory(id){
			$.ajax({
				type:"get",
				url:"/matter/matter/getDirectory?id="+id,
				dataType:"json",
				success:function (d) {
					if(d.length>0){
						//对应的值传回，拼出html下拉框语句
						var tmp='<option value="">请选择，输入关键字检索</option>';
						for (var i in d){
							tmp +='<option value="'+d[i].id+'">'+d[i].name+'</option>';
						}
						$("#directory_id").html(tmp);
						form.render();
					}

				},error:function () {
					layer.alert('请求失败');
				}
			});
		}


	}
</script>
{/block}
<!-- /脚本 -->
